package tedu.api.io;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class CopyDemo {
    public static void main(String[] args) throws IOException {
        FileInputStream fis = new FileInputStream("pb.jpeg");
        FileOutputStream fos = new FileOutputStream("pb_cp.jpeg");

        long start = System.currentTimeMillis();
        int b;
        while((b=fis.read())!=-1){//每次循环读取一个字节到d中，判断若不是-1，表示没有读取到末尾
            fos.write(b);
        }
        long end = System.currentTimeMillis();
        System.out.println("耗时："+(end-start)+"ms");

        System.out.println("复制完毕");
        fis.close();
        fos.close();

    }
}
